<!--#include file="../nav/admin_top.php" -->  
<script type="text/javascript">
var url_save = '<?=url::build('admin_vege','modify',array('reqtype'=>'json'))?>'; 
var url_return = '<?=url::build('admin_vege','index')?>';   
var types = <?=json_encode($types)?>;
$().ready(function(){  
	showLoading();   
  $('#name').focus();
	  
});
/* 保存 */
function fnSave(){
	var $price = $('#price').val();
	
	if(! fnRegExp('reg_num1',$price) ){
	
		alert('请填写正确的【菜品单价】');
		$('#price').focus();
		return false;
	}
	if(! fnRegExp('reg_num1',$('#pack').val()) ){
	
		alert('请填写正确的【包装规格】');
		$('#pack').focus();
		return false;
	}
	
	if($('#code').val() == ''){
		alert('请填写【菜品编号】');
		$('#code').focus();
		return false;
	}
	if($('#name').val() == ''){
		alert('请填写【菜品名称】');
		$('#name').focus();
		return false;
	}
	return true;
}
</script>
<div class="titleDiv">
	<div class="titleCaption">
		<span class="captionSpan">菜品管理 - 编辑菜品</span>
		<span class="totalSpan"> <label id="captionNum"></label> </span>
	</div>
</div>
<form id="myform" action="" method="post" enctype="multipart/form-data"  onsubmit="return fnSave();">
<input type="hidden" id="id" name="id" value="{$rs.id}" />
<div class="blockdiv">
	<div class="titlediv">基本信息</div>
	<table class="mytable" > 
		<tr>
			<td class="mylabel"><span class="red">*</span>菜品品牌：</td>
			<td class="myinfo" > 
				<select id="logo_id" name="logo_id" class="textBox"  > 
					<?PHP
					foreach($logos as $v){ 
						if($rs['logo_id'] == $v['id']){
							echo '<option value="'.$v['id'].'" selected="selected">'.$v['logo_name'].'</option>';
						}else{
							echo '<option value="'.$v['id'].'">'.$v['logo_name'].'</option>';
						}
					}
					?> 
				</select>
			</td>  
		</tr> 
		<tr>
			<td class="mylabel"><span class="red">*</span>菜品类别：</td>
			<td class="myinfo" > 
				<select id="type_id" name="type_id" class="textBox"  > 
					<?PHP
					foreach($types as $v){ 
						if($rs['type_id'] == $v['id']){
							echo '<option value="'.$v['id'].'" selected="selected">'.$v['type_name'].'</option>';
						}else{
							echo '<option value="'.$v['id'].'">'.$v['type_name'].'</option>';
						}
					}
					?> 
				</select>
			</td>  
		</tr> 
		<tr>
			<td class="mylabel"><span class="red">*</span>菜品编号：</td>
			<td class="myinfo" > 
				<input type="text" class="textBox" id="code" name="code" maxlength="100" value="{$rs.code}" style="width:80%" />
			</td>  
		</tr> 
		<tr>
			<td class="mylabel"><span class="red">*</span>菜品名称：</td>
			<td class="myinfo" > 
				<input type="text" class="textBox" id="name" name="name" maxlength="100" value="{$rs.name}" style="width:80%" />
			</td>  
		</tr> 
		<tr>
			<td class="mylabel"><span class="red">*</span>菜品单价：</td>
			<td class="myinfo" > 
				<input type="text" class="textBox" id="price" name="price" maxlength="8" value="{$rs.price}"  style="width:80px;text-align:right" /> 元
			</td>  
		</tr> 
		<tr>
			<td class="mylabel"><span class="red">*</span>包装规格：</td>
			<td class="myinfo" > 
				<input type="text" class="textBox" id="pack" name="pack" maxlength="8" value="{$rs.pack}"  style="width:80px;text-align:right" /> KG/份
			</td>  
		</tr> 
		<tr>
			<td class="mylabel">最大可选份数：</td>
			<td class="myinfo" > 
				<select class="textBox" name="maxnum" id="maxnum">
					<option value="0"  <?PHP if($rs['maxnum']=='0' || $rs['maxnum']=='') echo 'selected="selected"'; ?> >无限制</option>
					<?PHP
					for($i=1; $i<=20; $i++){
						if($rs['maxnum'] == $i){
							echo '<option value="'.$i.'" selected="selected">'.$i.'份</option>';
						}else{
							echo '<option value="'.$i.'" >'.$i.'份</option>';
						}
					}
					?>
				</select>
				<span class="gray">该菜品作为配送计划中的可选菜品时，用户最多选取的数量</span>
			</td>  
		</tr> 
		<tr>
			<td class="mylabel">说明：</td>
			<td class="myinfo" >
				<textarea class="textBox" id="remark" name="remark" style="width:80%;height:100px;">{$rs.remark}</textarea>   
			</td>  
		</tr>
		<tr>
			<td class="mylabel">状态：</td>
			<td class="myinfo" >
				<select id="sale" name="sale" class="textBox">
					<option value="1" <?PHP if($rs['sale'] == '1') echo 'selected="selected"'; ?>>当季供应</option>
					<option value="0" <?PHP if($rs['sale'] == '0') echo 'selected="selected"'; ?>>非当季供应</option>
				</select>
			</td>
		</tr>
		<tr>
			<td class="mylabel">缩略图：</td>
			<td class="myinfo" >
				<div style="margin:5px;margin-bottom:15px;">
					<?PHP
					if($rs['pic'] != ''){ 
						echo '<img src="'.$themeUrl.$rs['pic'].'"  width="120" height="90"  />';
						echo '  <span style="color:red"> 删除图片</span><input type="checkbox" name="del_pic" />';
					 
					}
					?>
				</div>		
				<div style="margin:3px auto">		
					<input type="file" id="pic" name="pic" />
					<span class="red">需要更换此图，请选择图片文件，否则请留空！（高宽比例 3:4）</span>
				</div>	
			</td>  
		</tr> 
	</table>
</div>
<div  class="button_div">
	<input type="submit" value="保 存" />
	<span class="gray">或</span> 
	<button class=" " onclick="jumpTo(url_return);return false;">返 回</button>
</div>  
</form>		
<!--#include file="../nav/admin_bottom.php" -->